
import Debug.QuickCheck

-- absolute x returns the absolute value of x
absolute :: Integer -> Integer
absolute x | x >= 0 = x
absolute x | x < 0  = -x

prop_Absolute x =
  absolute x >= 0

-- power x n returns x to the power n
power :: Integer -> Integer -> Integer
power x 0         = 1
power x n | n > 0 = x * power x (n-1)

prop_PowerAdd x m n =
  m >= 0 && n >= 0 ==>
    power x (m+n) == power x m * power x n

prop_PowerMultiply x m n =
  m >= 0 && n >= 0 ==>
    power x (m*n) == power (power x m) n

